package cn.com.guage.dtm.check.task;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import cn.com.guage.dtm.check.common.demain.DBResultSet;
import cn.com.guage.dtm.check.common.template.DataCheckTemplateAbastract;
import cn.com.guage.dtm.check.domain.User;
import cn.com.guage.dtm.check.service.IUserService;
import cn.com.guage.dtm.check.utils.FieldCheckUtils;

@Component
public class UserDataCheckJob extends DataCheckTemplateAbastract {

	@Autowired
	private IUserService userService;

	@Override
	protected DBResultSet<List<User>> getDBResultSet() {
		DBResultSet<List<User>> result = new DBResultSet<List<User>>();
		User user = new User();
		List<User> list = userService.selectUserList(user);
		result.setData(list);
		return result;
	}

	@Override
	protected void checkData() {
		DBResultSet<List<User>> data = getDBResultSet();
		if (!CollectionUtils.isEmpty(data.getData())) {
			List<User> list = data.getData();
			for (User user : list) {
				String name = user.getName();
				String birthday = user.getBirthday();
				String password = user.getPassword();
				Boolean nameResult = FieldCheckUtils.isEmpty(name);
				Boolean birthdayResult = FieldCheckUtils.isEmpty(birthday);
				Map<Boolean, String> passwordResult = FieldCheckUtils.isStrongPwd(password);
			}
		}
	}

	@Override
	protected void howSolve() {

	}

	@Override
	protected void haveLearnt() {

	}

}
